const mongoose = require("mongoose");
const userSchema = new mongoose.Schema({
  username: {
    type: String,
    required: true,
    minlength: 2,
    maxlength: 10,
  },
  email: {
    type: String,
    unique: true,
  },
  password: {
    type: String,
    required: true,
  },
  role: {
    type: String,
    required: true,
  },
  state: {
    type: Number,
    default: 0,
  },
});
const User = mongoose.model("User", userSchema);
/* User.create({
  username: "cz",
  email: "123@qq.com",
  password: "123",
  role: "admin",
  state: 0,
})
  .then(() => {
    console.log(`用户创建成功...`);
  })
  .catch((err) => {
    console.log(`用户创建失败`);
  }); */
module.exports = {
  User,
};
